<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //string->数字
        console.log(parseInt("12")+3);//15

        console.log(parseFloat("3.14")+3);

        //取整
        console.log(parseInt(9/2));//4

        console.log(isNaN("a"));//true

        //eval
        //1. 强制计算字符串
        console.log(eval("35+5*10"));//85

        //2. json
        let json_str = '{"id":1,"name":"tom"}';
        //json字符串转成json对象  - 单个对象
        let json_obj = eval('('+json_str+')');
        //通过json对象的key,获取json对象的value
        console.log(json_obj.name);

        console.log(encodeURI("file:///Users/admin/Desktop/dy-2022-h5/part04-js/9-中国强大.html"));

        console.log(decodeURI("file:///Users/admin/Desktop/dy-2022-h5/part04-js/9-%E4%B8%AD%E5%9B%BD%E5%BC%BA%E5%A4%A7.html"));
    </script>
</body>
</html>